import HTMLTestRunner_cn
import logging,yagmail

class Tools():
    def test_report(self):
        report = HTMLTestRunner_cn.HTMLTestRunner(open('baidu.html','wb'),title='百度po模型测试报告',description='百度高级搜索业务')
        return report

    def send_log(self):
        log = logging.basicConfig(level=logging.DEBUG,
                                  format='%(message)s %(levelname)s %(filename)s %(asctime)s %(lineno)s',
                                  filename='baidu.log',
                                  filemode='w+')
        return log

    def send_email(self,file):
        email = yagmail.SMTP(user='1847537889@qq.com',password='liavbivsorckhacj',host='smtp.qq.com')
        email.send(to='1847537889@qq.com',subject='百度po模型',contents='百度的高级搜索业务',attachments=file)
        # email.send(to='1847537889@qq.com',subject='百度po模型',contents=['百度的高级搜索业务','baidu.log','baidu.html'])

